﻿##################################################
# Found New Kingdom
# by some unknown hero
##################################################

found_kingdom_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_dynasty_house.dds"
	major = yes
	ai_check_interval = 60
	desc = found_kingdom_decision_desc

	is_shown = {
		highest_held_title_tier = tier_duchy
		NOT = { has_game_rule = off_custom_kingdoms }
	}

	is_valid = {
		prestige_level >= 3
		is_independent_ruler = yes
		OR = {
			custom_description = {
				text = found_kingdom_decision_three_duchies_held
				any_held_title = {
					count > 2
					tier = tier_duchy
				}
			}
			sub_realm_size >= 30
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
		is_at_war = no
	}

	cost = {
		gold = 300
		prestige = 500
		piety = 200
	}

	effect = {
		create_custom_kingdom_effect = yes
		if = {
			limit = {
				is_ai = no
				NOT = { exists = global_var:found_kingdom_decision  }
			}
			set_global_variable = {
				name = found_kingdom_decision
				value = root
			}
			set_global_variable = {
				name = found_kingdom_decision_kingdom
				value = root.primary_title
			}
		}
	}

	ai_potential = {
		always = no
	}

	ai_will_do = {
		base = 0
	}
}

##################################################
# Found New Empire
# by some unknown hero
##################################################

found_empire_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_dynasty_house.dds"
	major = yes
	ai_check_interval = 60
	desc = found_empire_decision_desc

	is_shown = {
		highest_held_title_tier = tier_kingdom
		OR = {
			is_independent_ruler = yes
			any_held_title = {
				count >= 3
				tier = tier_kingdom
			}
		}
		NOT = { has_game_rule = off_custom_kingdoms }
	}

	is_valid = {
		prestige_level >= 4
		OR = {
			sub_realm_size >= 120
			AND = {
				custom_description = {
					text = found_empire_decision_three_kingdoms_held
					any_held_title = {
						count >= 3
						tier = tier_kingdom
					}
				}
				sub_realm_size >= 80
			}
		}
	}

	is_valid_showing_failures_only = {
		is_independent_ruler = yes
		is_available_adult = yes
		is_at_war = no
	}

	cost = {
		gold = 1200
		prestige = 2000
		piety = 600
	}

	effect = {
		create_custom_empire_effect = yes
		if = {
			limit = {
				is_ai = no
				NOT = { exists = global_var:found_empire_decision  }
			}
			set_global_variable = {
				name = found_empire_decision
				value = root
			}
			set_global_variable = {
				name = found_empire_decision_empire
				value = root.primary_title
			}
		}
	}

	ai_potential = {
		always = no
	}

	ai_will_do = {
		base = 0
	}
}